package com.jz.community.modulemine.presenter;

import com.jz.community.basecomm.bean.BaseResponseText;
import com.jz.community.basecomm.mvp.BaseLifeCyclePresent;
import com.jz.community.basecomm.net.rxandroid.OnLoadListener;
import com.jz.community.modulemine.bean.ShareBean;
import com.jz.community.modulemine.bean.UserInfoResultBean;
import com.jz.community.modulemine.model.MineModel;
import com.jz.community.modulemine.model.MineModelImp;
import com.jz.community.modulemine.ui.MineView;

/**
 * Created by Admin on 2018/3/28 0028.
 */

public class MinePresenter extends BaseLifeCyclePresent<MineView.View> implements MineView.Presenter {


    private MineView.View view;
    private MineModel mineModel;

    public MinePresenter(MineView.View view) {
        this.view = view;
        this.mineModel = new MineModelImp(view.getContext());
    }

    @Override
    public void unreadCount(String type) {
        mineModel.unreadCount(type, new OnLoadListener<Integer>() {
            @Override
            public void onSuccess(Integer integer) {
                view.showCount(integer);
            }

            @Override
            public void onFail(String msg, int code) {
                view.showError(msg);
            }
        });
    }

    @Override
    public void initSharegift() {
        mineModel.initShareGift(new OnLoadListener<ShareBean>() {
            @Override
            public void onSuccess(ShareBean shareBean) {
                view.shareGiftSuccess(shareBean);
            }

            @Override
            public void onFail(String msg, int code) {
                view.shareGiftFail(msg);

            }
        });
    }

}
